<?php
$act = $_GET['do'];

if ( $act == "SiteList" )
{
	$i = 0;
	$query = $DB->Query("Select * From cms_webpage");
	
	while( $row = $DB->FetchArray($query) )
	{
		$List[$i]['ID']   = Decode($row['id']);
		$List[$i]['Name'] = Decode($row['name']);
		$List[$i]['Link'] = Decode($row['link']);
		$i++;
	} 
	
	$Template->assignByRef('List',$List);
	$Template->display('ajax_sitelist.html');
}
elseif ( $act == "SiteDetele" && isset($_GET['SiteID']) )
{
	$SiteID = intval($_GET['SiteID']);
	$strSQL = "DELETE FROM `cms_webpage` WHERE `id` =$SiteID";
	$query = $DB->Query($strSQL);
	if ( $query )
		echo 1;
	else
		echo mysql_error();
}
else
{
	exit;
}
?>